/**
 * @title  contract deploy
 */
const { devlopmentChains, chainConfig } = require("../helper-hardhat-config")
const { network } = require("hardhat")
const { verifyContract } = require("../utils/verify")
module.exports = async (hre) => {
    const { getNamedAccounts, deployments } = hre
    const { deploy, log } = deployments
    const { deployer } = await getNamedAccounts() //获取部署合约的地址

    log("the BasicNFT contract deploying ")

    //合约构造器参数
    const args = []
    const BasicNFT = await deploy("BasicNFT", {
        from: deployer,
        args: args, //合约构造器参数
        log: true,
        // @ts-ignore
        waitConfirmations: network.config.blockConfirmations || 1,
    })

    log("BasicNFT is deployed")

    if (
        !devlopmentChains.includes(network.name) &&
        process.env.ETHERSCAN_API_KEY
    ) {
        await verifyContract(BasicNFT.address, args)
    }
    log("-----------------------------")
}

module.exports.tags = ["all", "BasicNFT"]
